package com.sky.utils;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class Utils {
	
	public static int versionStringCmp(String v1,String v2)
	{
		if(v1.length() != v2.length())
		{
			return v1.length() - v2.length();
		}
		
		return v1.compareTo(v2);
	}
	
	public static Date changeTimeZone(Date date, TimeZone oldZone, TimeZone newZone)
	{
	    Date dateTmp = null;  
	    if (date != null) {  
	        int timeOffset = oldZone.getRawOffset() - newZone.getRawOffset();  
	        dateTmp = new Date(date.getTime() - timeOffset);  
	    }  
	    return dateTmp;  
	}
	
	public static Date dateChange(Date date,int days)
	{
		 Calendar calendar = new GregorianCalendar(); 
		 calendar.setTime(date);
		 calendar.add(calendar.DATE, days);
		 
		 return calendar.getTime();
	}
	
}
